package com.ficus.road.maintain.dao.smartnew;

import com.ficus.road.maintain.core.dao.BaseMongoDao;
import com.ficus.road.maintain.core.model.smartnew.SmartValuation;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * @author xiawen yang
 * @date 2022/7/14 下午9:26
 */
@Component
public class SmartValuationMergedDao extends BaseMongoDao<SmartValuation, String> {
    @Override
    public String getCollectionName() {
        return "smart_valuation_merged";
    }

    public void test(){
        List<SmartValuation> pci = findByQuery(new Query(Criteria.where("length").is(null)));
        pci.forEach(i ->{
            update(i.getId(), Update.update("length", 0));
        });
        System.out.println(1);
    }
}
